<?php defined('IN_IA') or exit('Access Denied');?><?php (!empty($this) && $this instanceof WeModuleSite || 1) ? (include $this->template('public/header', TEMPLATE_INCLUDEPATH)) : (include template('public/header', TEMPLATE_INCLUDEPATH));?>
<?php (!empty($this) && $this instanceof WeModuleSite || 1) ? (include $this->template('public/comhead', TEMPLATE_INCLUDEPATH)) : (include template('public/comhead', TEMPLATE_INCLUDEPATH));?>
<link rel="stylesheet" type="text/css" href="../addons/yzzc_sun/template/public/ygcss.css">
<style>
    .layui-form-label{width:120px}
</style>

<ul class="nav nav-tabs">
    <span class="ygxian"></span>
    <div class="ygdangq">当前位置:</div>
    <li class="active"><a href="javascript:void(0);">添加租车券</a></li>
    <li><a href="<?php  echo $this->createWebUrl('renting');?>"><i class="fa fa-refresh"></i>返回租车券列表</a></li>
</ul>

<div class="main">
    <form action="" method="post" class="form-horizontal form" enctype="multipart/form-data">
        <div class="layui-form-item">
            <label class="layui-form-label">租车券名称</label>
            <div class="layui-input-inline">
                <input class="layui-input" type="text" name="title" value="<?php  echo $info['title'];?>"/>
            </div>
        </div>

        <div class="layui-form-item " id="cash">
            <div class="layui-inline">
                <label class="layui-form-label">单笔满</label>
                <div class="layui-input-inline" style="width: 100px;">
                    <input type="text" name="full" value="<?php  echo $info['full'];?>" placeholder="填写正整数" autocomplete="off" class="layui-input">
                </div>
                <div class="layui-form-mid">立减</div>
                <div class="layui-input-inline" style="width: 100px;">
                    <input type="text" name="money" value="<?php  echo $info['money'];?>" placeholder="填写正整数" autocomplete="off" class="layui-input">
                </div>
                <div class="layui-form-mid layui-word-aux">元</div>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">活动开始时间</label>
            <div class="layui-input-inline">
                <input type="text" class="layui-input" name="start_time" value="<?php  echo $info['start_time'];?>" id="astime" placeholder="yyyy-MM-dd H:i:s">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">活动结束时间</label>
            <div class="layui-input-inline">
                <input type="text" class="layui-input" name="end_time" value="<?php  echo $info['end_time'];?>" id="antime" placeholder="yyyy-MM-dd H:i:s">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">是否限量</label>
            <div class="layui-input-inline">
                <input onchange="check(this)"  type="radio"  value="1" name="xl" <?php  if($info['total']==0 || empty ($info['total'])) { ?>checked<?php  } ?> >不限量
                <input onchange="check(this)" type="radio" value="0" name="xl" <?php  if($info['total']>0) { ?>checked<?php  } ?> >限量
            </div>
        </div>
        <div class="layui-form-item" id="total" style="display: none">
            <label class="layui-form-label">发放数量</label>
            <div class="layui-input-inline">
                <input class="layui-input" type="text" name="total" value="<?php  echo $info['total'];?>"/>
            </div>
        </div>

        <div class="layui-form-item">
        <label class="layui-form-label">所需积分</label>
        <div class="layui-input-inline">
        <input type="text" name="score" value="<?php  echo $info['score'];?>" autocomplete="off" class="layui-input">
        </div>
        </div>

        <div class="form-group">

            <input type="submit" name="submit" value="保存设置" class="btn col-lg-3" style="color: white;background-color: #444444;margin-left: 550px;"/>

            <input type="hidden" name="token" value="<?php  echo $_W['token'];?>" />
            <input type="hidden" name="id" value="<?php  echo $info['id'];?>" />

        </div>


    </form>
</div>

<script type="text/javascript">
    function check() {
        var a= $('input[name="xl"]:checked').val()
        if(a==0){
            $('#total') .show();
        }else{
            $('#total') .hide();
        }
    }
    layui.use('laydate', function () {
        var laydate = layui.laydate;
        laydate.render({
            elem: '#astime',
            type: 'datetime'
        });
        laydate.render({
            elem: '#antime',
            type: 'datetime'
        });
    });

    layui.use('form', function () {
        var form = layui.form;
        form.render();
        form.on('radio(type)', function (data) {
            if (this.value == 1) {
                $('#cash').hide()
                $('#discount').show()
            } else {
                $('#discount').hide()
                $('#cash').show()
            }
        })

    });
</script>

<script type="text/javascript">
    $(function () {
        $("#frame-9").show();
        $("#yframe-9").addClass("wyactive");
        var xl= $('input[name="xl"]:checked').val()
        if(xl==0){
            $('#total').show();
        }
    })

    function reload() {
        //提交租车券数据表单之后对页面进行刷新,放置重复提交
        window.location.reload();

    }
</script>